<template>
    <div class="container">
        <!-- 左侧面板 -->
        <div class="leftBox">
            <!-- 大桥信息 -->
            <div class="panel-box bridge-info-panel" style="flex: 1;">
                <div class="panel-title">
                    <span class="title-text">大桥</span>
                </div>
                <div style="display: flex;flex-direction: column;justify-content: center;height: 85%;">
                    <div class="info-list">
                        <div class="info-item">
                            <img class="img" src="@/assets/imgs/home/定位-位置.png" alt="位置">
                            <div class="info-text">
                                <span class="label">位置</span>
                                <span class="value">甘孜藏族自治州巴塘县</span>
                            </div>
                        </div>
                        <div class="info-item">
                            <img class="img" src="@/assets/imgs/home/长度.png" alt="长度">
                            <div class="info-text">
                                <span class="label">长度</span>
                                <span class="value">361.54 M</span>
                            </div>
                        </div>
                        <div class="info-item">
                            <img class="img" src="@/assets/imgs/home/宽度.png" alt="宽度">
                            <div class="info-text">
                                <span class="label">宽度</span>
                                <span class="value">19.1 M</span>
                            </div>
                        </div>
                        <div class="info-item">
                            <img class="img" src="@/assets/imgs/home/桥墩.png" alt="桥墩">
                            <div class="info-text">
                                <span class="label">桥墩数量</span>
                                <span class="value">15 孔</span>
                            </div>
                        </div>
                        <div class="info-item">
                            <img class="img" src="@/assets/imgs/home/载重.png" alt="载重">
                            <div class="info-text">
                                <span class="label">限重</span>
                                <span class="value">50 吨</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 入网记录 -->
            <div class="panel-box record-panel" style="flex: 2;">
                <div class="panel-title">
                    <span class="title-text">入网记录</span>
                </div>
                <div class="status-grid">
                    <div class="status-item">
                        <img class="img" src="@/assets/imgs/home/新入网.png" alt="新入网">
                        <div class="state-text">
                            <span class="label">已入网</span>
                            <span class="value">0</span>
                        </div>
                    </div>
                    <div class="status-item">
                        <img class="img" src="@/assets/imgs/home/计划待处理.png" alt="计划待处理">
                        <div class="state-text">
                            <span class="label">待处理</span>
                            <span class="value">1</span>
                        </div>
                    </div>
                    <div class="status-item">
                        <img class="img" src="@/assets/imgs/home/定位授权.png" alt="定位授权">
                        <div class="state-text">
                            <span class="label">定位授权</span>
                            <span class="value">0</span>
                        </div>
                    </div>
                </div>
                <BasicTable :columns="columns" :data="recordData" :isPage="false" height="300">
                    <template #operate="{ row }">
                        <img class="img" src="@/assets/imgs/home/全部通过.png" alt="全部通过">
                        <img class="img" style="margin-left: 10px;" src="@/assets/imgs/home/拒绝.png" alt="拒绝">
                    </template>
                </BasicTable>
            </div>

            <!-- 今日车辆通行记录 -->
            <div class="panel-box vehicle-record-panel" style="flex: 1;">
                <div class="panel-title">
                    <span class="title-text">今日车辆通行记录</span>
                </div>
                <div style="display: flex;flex-direction: column;justify-content: center;height: 100%;">
                    <div class="record-grid">
                        <div class="item-info">
                            <img class="img" src="@/assets/imgs/home/车流量.png" alt="车流量">
                            <span class="label">车辆总数</span>
                            <span class="value">2</span>
                        </div>
                        <div class="item-info">
                            <img class="img" src="@/assets/imgs/home/大巴车.png" alt="大巴车">
                            <span class="label">客运车</span>
                            <span class="value">2</span>
                        </div>
                        <div class="item-info">
                            <img class="img" src="@/assets/imgs/home/汽车.png" alt="汽车">
                            <span class="label">汽车</span>
                            <span class="value">2</span>
                        </div>
                        <div class="item-info">
                            <img class="img" src="@/assets/imgs/home/货车.png" alt="货车">
                            <span class="label">货车</span>
                            <span class="value">2</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- 中间区域 -->
        <div class="centerBox">
            <!-- <Map /> -->
        </div>

        <!-- 右侧面板 -->
        <div class="rightBox">
            <!-- 天气状况 -->
            <div class="panel-box weather-panel" style="flex: 1;">
                <div class="panel-title">
                    <span class="title-text">天气状况</span>
                </div>
                <div style="display: flex;flex-direction: column;justify-content: center;height: 90%;">
                    <div class="weather-grid">
                        <div class="weather-item">
                            <img class="img" src="@/assets/imgs/home/阴天.png" alt="阴天">
                            <div class="info-text">
                                <span class="label">天气</span>
                                <span class="value">阴</span>
                            </div>
                        </div>
                        <div class="weather-item">
                            <img class="img" src="@/assets/imgs/home/阴天.png" alt="阴天">
                            <div class="info-text">
                                <span class="label">风力</span>
                                <span class="value">≤3级</span>
                            </div>
                        </div>
                        <div class="weather-item">
                            <img class="img" src="@/assets/imgs/home/温度.png" alt="温度">
                            <div class="info-text">
                                <span class="label">温度</span>
                                <span class="value">11°C</span>
                            </div>
                        </div>
                        <div class="weather-item">
                            <img class="img" src="@/assets/imgs/home/温度.png" alt="温度">
                            <div class="info-text">
                                <span class="label">风向</span>
                                <span class="value">东南风</span>
                            </div>
                        </div>
                        <div class="weather-item">
                            <img class="img" src="@/assets/imgs/home/温度.png" alt="温度">
                            <div class="info-text">
                                <span class="label">空气湿度</span>
                                <span class="value">35%</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 设备概览 -->
            <div class="panel-box device-panel" style="flex: 1;">
                <div class="panel-title">
                    <span class="title-text">设备概览</span>
                </div>
                <div style="display: flex;flex-direction: column;justify-content: center;height: 75%;">
                    <div class="device-grid">
                        <div class="device-item">
                            <img class="img" src="@/assets/imgs/home/摄像头.png" alt="摄像头">
                            <span class="label">监控设备</span>
                            <span class="value">20</span>
                        </div>
                        <div class="device-item">
                            <img class="img" src="@/assets/imgs/home/消防设备.png" alt="消防设备">
                            <span class="label">消防设备</span>
                            <span class="value">20</span>
                        </div>
                        <div class="device-item">
                            <img class="img" src="@/assets/imgs/home/车道指示器.png" alt="车道指示器">
                            <span class="label">车道指示器</span>
                            <span class="value">20</span>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 地图区域 -->
            <div class="panel-box map-panel" style="flex: 2;">
                <div class="panel-title">
                    <span class="title-text">地图区域</span>
                </div>
                <div class="map-container">
                    <!-- 地图内容将在这里 -->
                    <img class="img" src="@/assets/imgs/home/金沙江大桥.png" alt="金沙江大桥">
                </div>
            </div>
        </div>
    </div>
</template>

<script setup>
import { h, ref } from 'vue'
import { ElButton } from 'element-plus'

const columns = [
    {
        prop: 'carNo',
        label: '车牌号'
    },
    {
        prop: 'time',
        label: '申请时间'
    },
    {
        prop: 'auth',
        label: '定位授权'
    },
    {
        prop: 'operate',
        label: '操做',
        renderHeader: () => {
            return h(ElButton, { type: 'primary', link: true }, { default: () => '一键通过' })
        },
        width: 100
    }
]

// 模拟数据
const recordData = ref([
    {
        index: 1,
        carNo: '川A12345',
        time: '2024-03-18 10:00',
        auth: '已授权'
    },
    {
        index: 1,
        carNo: '川A12345',
        time: '2024-03-18 10:00',
        auth: '已授权'
    },
    {
        index: 1,
        carNo: '川A12345',
        time: '2024-03-18 10:00',
        auth: '已授权'
    },
    {
        index: 1,
        carNo: '川A12345',
        time: '2024-03-18 10:00',
        auth: '已授权'
    },
    {
        index: 1,
        carNo: '川A12345',
        time: '2024-03-18 10:00',
        auth: '已授权'
    },
    {
        index: 1,
        carNo: '川A12345',
        time: '2024-03-18 10:00',
        auth: '已授权'
    },
    {
        index: 1,
        carNo: '川A12345',
        time: '2024-03-18 10:00',
        auth: '已授权'
    },
    {
        index: 1,
        carNo: '川A12345',
        time: '2024-03-18 10:00',
        auth: '已授权'
    },

])



</script>

<style lang="scss" scoped>
.container {
    background: #001529;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    // padding: 16px;
    gap: 16px;
    overflow: hidden;
    position: relative;

    .leftBox,
    .rightBox {
        z-index: 9;
        width: 650px;
        display: flex;
        flex-direction: column;
        gap: 16px;
        overflow: hidden;
    }

    .centerBox {
        position: absolute;
        z-index: 1;
        height: 100%;
        width: 100%;

        // .map-container {
        //     width: 100%;
        //     height: 100%;
        //     border-radius: 8px;
        //     position: relative;
        // }

    }
}

.panel-box {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 16px;
    position: relative;
    overflow: hidden;
    flex: 1;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(64, 224, 208, 0.1);



    .panel-title {
        font-size: 16px;
        font-weight: bold;
        margin-bottom: 16px;
        position: relative;
        padding-left: 24px;
        color: #40E0D0;

        &::before {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 4px;
            height: 16px;
            background: #40E0D0;
            border-radius: 2px;
        }

        &::after {
            content: '';
            position: absolute;
            left: 0px;
            right: 0;
            // top: 50%;
            bottom: -10px;
            height: 1px;
            background: linear-gradient(90deg, #40E0D0, transparent);
        }
    }

    // 大桥信息样式
    &.bridge-info-panel {
        .info-list {
            // display: flex;
            // flex-direction: column;
            display: grid;
            gap: 12px;
            grid-template-columns: repeat(3, 1fr);

            .info-item {
                display: flex;
                align-items: center;
                gap: 12px;
                padding: 8px;
                border-radius: 4px;
                transition: background-color 0.3s;

                &:hover {
                    background: rgba(64, 224, 208, 0.1);
                }

                .img {
                    width: 32px;
                    height: 32px;
                }

                .info-text {
                    display: flex;
                    flex-direction: column;
                    gap: 4px;

                    .label {
                        color: rgba(255, 255, 255, 0.6);
                        width: 80px;
                    }

                    .value {
                        color: #fff;
                    }
                }
            }
        }
    }

    // 入网记录样式
    &.record-panel {
        .status-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 16px;
            margin-bottom: 16px;

            .status-item {
                display: flex;
                align-items: center;
                gap: 8px;
                padding: 12px;
                background: rgba(64, 224, 208, 0.1);
                border-radius: 8px;
                transition: transform 0.3s;

                // &:hover {
                //     transform: translateY(-2px);
                // }

                .img {
                    width: 50px;
                    height: 50px;
                }

                .state-text {
                    display: flex;
                    flex-direction: column;
                    align-items: center;
                    gap: 4px;

                    .label {
                        color: rgba(255, 255, 255, 0.6);
                    }

                    .value {
                        font-size: 20px;
                        font-weight: bold;
                        color: #40E0D0;
                    }
                }
            }
        }

        .img {
            width: 25px;
            height: 25px;
            cursor: pointer;
        }


    }

    // 今日车辆通行记录
    &.vehicle-record-panel {
        .record-grid {
            display: grid;
            gap: 12px;
            grid-template-columns: repeat(4, 1fr);
            place-items: center;

            .item-info {
                display: flex;
                flex-direction: column;
                align-items: center;
                gap: 5px;
                transition: background-color 0.3s;

                &:hover {
                    background: rgba(64, 224, 208, 0.1);
                }

                .img {
                    width: 32px;
                    height: 32px;
                }

                .label {
                    color: rgba(255, 255, 255, 0.6);
                }

                .value {
                    color: #fff;
                }
            }

            .item-info:first-child {
                .img {
                    width: 90px;
                    height: 90px;
                }
            }
        }
    }

    // 天气状况样式
    &.weather-panel {
        .weather-grid {
            gap: 12px;
            display: grid;
            grid-template-columns: repeat(3, 1fr);

            .weather-item {
                display: flex;
                align-items: center;
                gap: 12px;
                padding: 8px;
                border-radius: 4px;
                transition: background-color 0.3s;

                &:hover {
                    background: rgba(64, 224, 208, 0.1);
                }

                .img {
                    width: 32px;
                    height: 32px;
                }

                .info-text {
                    display: flex;
                    flex-direction: column;
                    gap: 4px;

                    .label {
                        color: rgba(255, 255, 255, 0.6);
                        width: 80px;
                    }

                    .value {
                        color: #fff;
                    }
                }
            }
        }
    }

    // 设备概览样式
    &.device-panel {
        .device-grid {
            margin-top: 30px;
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 16px;

            .device-item {
                background: rgba(64, 224, 208, 0.1);
                border-radius: 8px;
                padding: 10px;
                display: flex;
                flex-direction: column;
                align-items: center;
                gap: 8px;
                transition: transform 0.3s;

                .img {
                    width: 70px;
                    height: 70px;
                }

                .label {
                    color: rgba(255, 255, 255, 0.6);
                }

                .value {
                    font-size: 20px;
                    font-weight: bold;
                    color: #40E0D0;
                }
            }
        }
    }

    // 地图区域样式
    &.map-panel {
        .map-container {
            // margin-top: 20px;
            // height: 380px;
            height: 90%;
            background: rgba(64, 224, 208, 0.1);
            border-radius: 8px;
            position: relative;
            overflow: hidden;

            .img {
                width: 100%;
                height: 100%;
            }

            &::after {
                content: '';
                position: absolute;
                top: 0;
                left: 0;
                right: 0;
                bottom: 0;
                background: linear-gradient(45deg, transparent, rgba(64, 224, 208, 0.1), transparent);
                animation: shine 2s infinite;
            }
        }
    }
}

@keyframes shine {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}
</style>